import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '地块编号',
    align: "center",
    dataIndex: 'no',
    helpMessage: '基地编号+3位自增流水号，例子：1000-01-001，1000-02-002，1001-01-001'
  },
  {
    title: '地块名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '地块属性',
    align: "center",
    dataIndex: 'attributes'
  },
  {
    title: '基地',
    align: "center",
    dataIndex: 'bid_dictText'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "地块名称",
    field: 'name',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "基地",
    field: 'bid',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 't_base,name,id',
      placeholder: '请选择基地',

    },
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '地块名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入地块名称!' },
      ];
    },
  },
  {
    label: '地块属性',
    field: 'attributes',
    component: 'Input',
  },
  {
    label: '基地',
    field: 'bid',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 't_base,name,id',
      placeholder: '请选择基地',
    },
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请选择基地!' },
      ];
    },
  },
  {
    label: '地块多边形',
    field: 'polygon',
    component: 'FNULL',
    helpMessage: '搜索地址，右键创建区域',
    show: false
  },
  {
    label: '边框色',
    field: 'strokeColor',
    component: 'Input',
    defaultValue: '#FF33FF',
    componentProps: {
      type: 'color'
    }
  },
  {
    label: '填充色',
    field: 'fillColor',
    component: 'Input',
    defaultValue: '#1791fc',
    componentProps: {
      type: 'color'
    }
  },
  {
    label: '面积',
    field: 'area',
    component: 'Input',
    componentProps: {
      suffix: '亩'//'㎡'
    }
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
